<?php
//用户组
class CoreGroupModel extends Model {
	var $_table = 'core_group';
	
	var $gid_nak; //INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '组编号，主键',
	var $gname_r; //VARCHAR(45) NOT NULL COMMENT '用户组标识',
	var $name_r; //VARCHAR(45) NOT NULL COMMENT '组名',
	var $reserved_nr = 0; //TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否是系统内置组',
	var $type_sr = 'user';//组类型,user：用户,vip：会员
	var $note = ''; //VARCHAR(256) NULL COMMENT '备注说明',
	
	public function check_gname($value, $data) {
		$where ['gname'] = $value;
		if (! empty ( $data ['gid'] )) {
			$where ['gid !='] = $data ['gid'];
		}
		return $this->exist ( $where ) ? "用户组标识已经存在" : true;
	}
}